package com.hsxc.cdz.monitor.bean.server.v1_33;

import com.hsxc.cdz.base.util.BytesUtil;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.util.ReferenceCountUtil;

/**
 * 设置二维码报文体
 * @author 刘力文
 *
 */
public class QRCSettingSerMsg extends ServerMessage {
	
	/********************************************************/
	//对象私有属性
	private String data; //运营二维码
	
	public static final int length = 8;
	
	/********************************************************/
	//get() and set()
	
	public String getData() {
		return data;
	}

	public void setData(String data) {
		this.data = data;
	}
	
	/********************************************************/
	//重写父类方法
	@Override
	public byte[] getBytesFromMessage() {
		ByteBuf bytes = Unpooled.buffer(length);
		byte[] result;
		byte[] temp;
		temp  = BytesUtil.strToBcdBytes(this.getData(), 8);
		bytes.writeBytes(temp);
		result = new byte[bytes.readableBytes()];
		bytes.readBytes(result);
		ReferenceCountUtil.release(bytes);
		return result;
	}

}
